package personal.vivian.groovy

def sql=groovy.sql.Sql.newInstance('jdbc:mysql://127.0.0.1:3306/groovy?useUnicode=true&characterEncoding=UTF-8','root','123456','com.mysql.cj.jdbc.Driver')
println(sql.connection.catalog)


println("city         tempature")
sql.eachRow('select * from weather'){
    printf "%-20s%s\n",it.city,it[1]
}